package com.tencent.weiyun.example.wxapi; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import cn.wps.moffice.OfficeApp; import cn.wps.moffice.extlibs.Qing3rdLoginConstants; import com.tencent.mm.opensdk.modelbase.BaseReq; import com.tencent.mm.opensdk.modelbase.BaseResp; import com.tencent.mm.opensdk.modelmsg.SendAuth; import com.tencent.mm.opensdk.modelmsg.SendMessageToWX; import com.tencent.mm.opensdk.openapi.IWXAPI; import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; import com.tencent.mm.opensdk.openapi.WXAPIFactory; import java.io.IOException; import java.lang.reflect.Method; import org.json.JSONException; import org.json.JSONObject; import org.scribe.model.OAuthConstants; public class WXEntryActivity extends Activity implements IWXAPIEventHandler { private static Method sLP; private IWXAPI hAI; /* access modifiers changed from: protected */ public void onCreate(Bundle bundle) { super.onCreate(bundle); this.hAI = WXAPIFactory.createWXAPI(this, Qing3rdLoginConstants.WECHAT_APP_ID, false); this.hAI.handleIntent(getIntent(), this); } /* access modifiers changed from: protected */ public void onNewIntent(Intent intent) { super.onNewIntent(intent); setIntent(intent); this.hAI = WXAPIFactory.createWXAPI(this, Qing3rdLoginConstants.WECHAT_APP_ID, false); this.hAI.handleIntent(intent, this); } @Override // com.tencent.mm.opensdk.openapi.IWXAPIEventHandler public void onReq(BaseReq baseReq) { } @Override // com.tencent.mm.opensdk.openapi.IWXAPIEventHandler public void onResp(final BaseResp baseResp) { try { if (sLP == null) { new AsyncTask<Void, Void, Void>() { /* class com.tencent.weiyun.example.wxapi.WXEntryActivity.AnonymousClass2 */ private static Void aLj() { ClassLoader classLoader; try { if (!ltk.iTs) { classLoader = ltv.getInstance().getExternalLibsClassLoader(); lue.a(OfficeApp.arx(), classLoader); } else { classLoader = drg.class.getClassLoader(); } Method unused = WXEntryActivity.sLP = classLoader.loadClass("com.socialtouch.ads.STAd").getMethod("onWechatResp", Context.class, Object.class, classLoader.loadClass("com.socialtouch.ads.STListener")); return null; } catch (Exception e) { e.printStackTrace(); return null; } } /* Return type fixed from 'java.lang.Object' to match base method */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object[]] */ /* access modifiers changed from: protected */ @Override // android.os.AsyncTask public final /* synthetic */ Void doInBackground(Void[] voidArr) { return aLj(); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ /* access modifiers changed from: protected */ @Override // android.os.AsyncTask public final /* synthetic */ void onPostExecute(Void r6) { super.onPostExecute(r6); if (WXEntryActivity.sLP != null) { try { WXEntryActivity.sLP.invoke(null, WXEntryActivity.this, baseResp, null); } catch (Throwable th) { th.printStackTrace(); } } } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]); } else { sLP.invoke(null, this, baseResp, null); } } catch (Throwable th) { } switch (baseResp.errCode) { case -2: if (baseResp instanceof SendMessageToWX.Resp) { fza.bJK().a((fyx) fva.SHARE_CANCEL, true); fza.bJK().a((fyx) fva.SHARE_RESULT, false); finish(); return; } case -1: default: if (baseResp instanceof SendAuth.Resp) { fmf.bzz(); break; } break; case 0: if (!(baseResp instanceof SendMessageToWX.Resp)) { Bundle bundle = new Bundle(); baseResp.toBundle(bundle); final String str = new SendAuth.Resp(bundle).code; new fcv<Void, Void, String>() { /* class com.tencent.weiyun.example.wxapi.WXEntryActivity.AnonymousClass1 */ private String atg() { try { return lxe.f("https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx3ebc9e606b4f9242&secret=e17100ce705e661d1bff167752bb8222&code=" + str + "&grant_type=authorization_code", null); } catch (IOException e) { return ""; } } /* Return type fixed from 'java.lang.Object' to match base method */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object[]] */ /* access modifiers changed from: protected */ @Override // defpackage.fcv public final /* synthetic */ String doInBackground(Void[] voidArr) { return atg(); } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ /* access modifiers changed from: protected */ @Override // defpackage.fcv public final /* synthetic */ void onPostExecute(String str) { try { JSONObject jSONObject = new JSONObject(str); WXEntryActivity wXEntryActivity = WXEntryActivity.this; fmf.i("wechat", jSONObject.optString("openid"), jSONObject.optString(OAuthConstants.ACCESS_TOKEN), null); } catch (JSONException e) { fmf.bzz(); } } }.execute(new Void[0]); break; } else { fza.bJK().a((fyx) fva.SHARE_RESULT, true); finish(); return; } } finish(); } }